package com.pingan.generator.api.controller;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;
import com.pingan.generator.api.entity.AppVersionInfo;
import com.pingan.generator.api.entity.BaseLog;
import com.pingan.generator.api.entity.Pager;
import com.pingan.generator.api.entity.StatisticsInfo;
import com.pingan.generator.api.entity.util.Response;
import com.pingan.generator.api.service.AppVersionInfoService;

@RestController
//@RequestMapping("/appVersion")
public class AppVersionInfoController extends BaseLog{
	
	@Autowired
	private AppVersionInfoService appVersionInfoService;

	//@RequestMapping(value="/save",method = RequestMethod.POST)
	@SuppressWarnings("unchecked")
	public Response<StatisticsInfo> save(@RequestBody AppVersionInfo appVersionInfo,HttpServletRequest request){
		int count = appVersionInfoService.save(appVersionInfo);
		if(count>1){
			return Response.success(null);
		}
		return Response.failure();
	}

	
//	@SuppressWarnings("unchecked")
//	@RequestMapping(value="/queryList",method = RequestMethod.POST)
//	public Response<PageInfo<AppVersionInfo> > queryList(@RequestBody Pager pager){
//		 if (pager.getParams() == null) {
//	            pager.setParams(new HashMap<String, Object>());
//	     }
//		return Response.success(appVersionInfoService.pagedList(pager));
//	}

//	@SuppressWarnings("unchecked")
//	@RequestMapping(value = "/removePushInfoInfo", method = RequestMethod.POST)
//	public Response<AppVersionInfo> removePushInfoInfo(@RequestBody AppVersionInfo appVersionInfo, HttpServletRequest request) {
//		int count = appVersionInfoService.deleteById(appVersionInfo);
//		if(count>1){
//			return Response.success(null);
//		}
//		return Response.failure();
//	}
//	
//	@RequestMapping(value = "/removePushInfoInfoByKey", method = RequestMethod.POST)
//	public Response<AppVersionInfo> removePushInfoInfoByKey(String id, HttpServletRequest request) {
//	    int  count = appVersionInfoService.deleteById(id);
//	    if(count>1){
//			return Response.success(null);
//		}
//	    return Response.failure();
//	}
	
	
	
	
	
}
